package com.animal.service.impl;


import com.animal.entity.pojo.AGoods;
import com.animal.mapper.GoodsMapper;
import com.animal.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public List<AGoods> getGoodsList(String goodsName,
                                    Integer status) {
        return goodsMapper.getGoodsList(goodsName,status);
    }

    @Override
    public boolean updateGoodById(AGoods aGoods) {
        int i = goodsMapper.updateGoodById(aGoods);
        if (i>0) {
            return  true;
        }else {
            return false;
        }
    }

    @Override
    public boolean addGoods(AGoods aGoods) {
        int i = goodsMapper.addGoods(aGoods);
        if (i>0) {
            return  true;
        }else {
            return false;
        }
    }

    @Override
    public boolean deleteGoodsById(Integer id) {
        int i = goodsMapper.deleteGoodsById(id);
        if (i>0) {
            return  true;
        }else {
            return false;
        }
    }

    @Override
    public boolean deleteGoods(List<Integer> ids) {
        int i = goodsMapper.deleteGoods(ids);
        if (i>0) {
            return  true;
        }else {
            return false;
        }
    }

    @Override
    public AGoods getGoodsById(Integer id) {
        return goodsMapper.getGoodsById(id);
    }


}
